package com.yanq.liancar.adapter;
/*
 *  @创建者     Administrator
 *  @创建时间   2018/11/12  11:25
 *  @描述       ${TODO}
 */


import android.support.annotation.Nullable;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yanq.liancar.R;
import com.yanq.liancar.bean.AgencyServiceBean;

import java.util.List;

public class AgencyServiceAdapter extends BaseQuickAdapter<AgencyServiceBean.DataBean, BaseViewHolder> {
    public AgencyServiceAdapter(int layoutResId, @Nullable List<AgencyServiceBean.DataBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, AgencyServiceBean.DataBean item) {
        RelativeLayout relativeLayout = helper.getView(R.id.ll_inspect);
        TextView textView1 = helper.getView(R.id.tv_inspect1);
        TextView textView2 = helper.getView(R.id.tv_inspect2);
        if (item.isChecked()) {
            relativeLayout.setBackground(mContext.getResources().getDrawable(R.drawable.selector_tv_bg_b));
            textView1.setTextColor(mContext.getResources().getColor(R.color.white));
            textView2.setTextColor(mContext.getResources().getColor(R.color.white));
        }else {
            relativeLayout.setBackground(mContext.getResources().getDrawable(R.drawable.selector_tv_bg_a));
            textView1.setTextColor(mContext.getResources().getColor(R.color.main_color));
            textView2.setTextColor(mContext.getResources().getColor(R.color.main_color));
        }

        helper.setText(R.id.tv_inspect1,item.getDbName())
                .setText(R.id.tv_inspect2,item.getDbPrice()+"元/年");
    }
}
